<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>首页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    
    <link rel="shortcut icon" th:href="@{https://candy-s.futurity.cn/ui/favicon.ico} "/>
    <link rel="stylesheet" th:href="@{/css/AIT/login/intlTelInput.css}"/>
    <link rel="stylesheet" th:href="@{/css/AIT/login/base.css}"/>
    <link rel="stylesheet" th:href="@{/css/AIT/login/login.css}"/>

    <!--<link rel="stylesheet" th:href="@{css/bootstrap.min.css} "/>-->
    <!--<link rel="stylesheet" th:href="@{css/font-awesome.min.css} "/>-->
    <!--<link rel="stylesheet" th:href="@{plugins/jqgrid/ui.jqgrid-bootstrap.css} "/>-->
    <!--<link rel="stylesheet" th:href="@{plugins/ztree/css/metroStyle/metroStyle.css} "/>-->
    <!--<link rel="stylesheet" th:href="@{css/main.css}" />-->

    <!--<script th:src="@{../libs/jquery.min.js}"/>-->
    <!--<script th:src="@{../plugins/layer/layer.js}"/>-->
    <!--<script th:src="@{../libs/bootstrap.min.js}"/>-->
    <!--<script th:src="@{../libs/vue.min.js}"/>-->
    <!--<script th:src="@{../libs/validator.min.js}"/>-->
    <!--<script th:src="@{../plugins/jqgrid/grid.locale-cn.js}"/>-->
    <!--<script th:src="@{../plugins/jqgrid/jquery.jqGrid.min.js}"/>-->
    <!--<script th:src="@{../plugins/jquery-validation/jquery.validate.min.js}"/>-->
    <!--<script th:src="@{../plugins/jquery-validation/jquery.validate.addMethod.js}"/>-->
    <!--<script th:src="@{../js/common.js}"/>-->


    <script th:src="@{/libs/jquery.min.js}"/>
    <script th:src="@{/plugins/layer/layer.js}"/>
    <script th:src="@{/libs/bootstrap.min.js}"/>
    <script th:src="@{/libs/vue.min.js}"/>
    <script th:src="@{/libs/validator.min.js}"/>
    <script th:src="@{/plugins/jqgrid/grid.locale-cn.js}"/>
    <script th:src="@{/plugins/jqgrid/jquery.jqGrid.min.js}"/>
    <script th:src="@{/plugins/jquery-validation/jquery.validate.min.js}"/>
    <script th:src="@{/plugins/jquery-validation/jquery.validate.addMethod.js}"/>
    <script th:src="@{/js/common.js}"/>


<script>

</script>
</head>

<body>

<div class="login-container">
    <div class="logo-content">
        <a href="">
            <img th:src="@{/img/AIT/login/logo111.png}"  alt="Orange.one" width="273" />
        </a>
        <p class="font50" onclick="testone()">Artificial Intelligence Data Credit Value Token</p>
        <p class="font50" th:text="${#httpServletRequest.getAttribute('code')}"></p>
        <!--<p class="color_ccc font24">All Candies in One Box</p>-->
        <div class="panelbox">
            <div class="row">
                <div class="col-lg-6 col-md-6 chinese">
                    <h2 class="H_line">AIT candy distribution invitation letter </h2>
                    <p>We are now pursuing a effective, convenient and humanized technology.  Trying to make the human-pc communicating system more functional, so this system can correct itself and learn from running. Fortunately the block chain comes out to kill our trouble. So we are dreaming bigger to achieve our goal  by AI and block chain and by the way the third party credit value scale will be saved, which is found to be a good circle. For making this, we have called on lots of allies who support and have full cognition on this industry. And finally we are honored to have this chance to appreciate all by distributing those candies.
                    </p>
                </div>
            </div>
        </div>
    </div>



    <!--注册-->
    <div class="login_form" id="BOX_Mailbox">
        <form>
            <p class="color_eee ptitle" >Please enter your e-mail address!</p>
            <div class="intl-tel-input allow-dropdown">
                <input type="hidden" id="invitcode" th:value="${#httpServletRequest.getAttribute('code')}"/>

                <!--</div>-->

                <!--去掉ID id="phone"-->
                <input type="text"  name="registerMail" id = "registerMail" class="inputbox" autofocus="" autocomplete="off" placeholder="ait*******@gmail.com" />
            </div>

            <span  class="signUp" id="BOX_Mailbox_btn" >next</span>

        </form>
    </div>
    <!--验证-->
    <div class="login_form" id="BOX_Code">
        <form  >
            <p class="color_eee ptitle">Please enter your email verification code!</p>
            <div class="hidebox">
                <input type="text" id="code" name="code" class="verification" autofocus="" maxlength="6" />
                <input name="status" value="send_msg" type="hidden" />
                <!--<input id="phone" name="phone" type="hidden" value="8615928991751" />-->
                <input id="countrycode" name="countrycode" type="hidden" value="CN" />
            </div>
            <div class="underline">
                <ul class="clearfix">
                    <li></li>
                    <li></li>
                    <li></li>
                    <li></li>
                    <li></li>
                    <li></li>
                </ul>
            </div>
            <!--onclick="return check_tel_code()" 取消掉了-->
            <!--<button  class="signUp">登陆</button>-->
            <span  class="signUp" id="BOX_Code_btn">confirm</span>
        </form>
        <!--<form id="pre_step_form" method="post" action="https://candy.one/">-->
        <!--</form>-->
    </div>
    <!--设置密码-->
    <div class="login_form" id="BOX_Pwd">
        <!--<form action="" method="post" id="login_data">-->
            <p class="color_eee ptitle">Please enter the password!</p>
            <div class="pswd_box">
                <i class="password_icon"></i>
                <input type="password" name="usr_pwd" id="usr_pwd" class="inputbox password" autofocus="" />
            </div>
            <!--<p class="color_eee ptitle" style="margin-top: 15px">confirm password!</p>-->
            <!--<div class="pswd_box">-->
                <!--<i class="password_icon"></i>-->
                <!--<input type="password" name="user_confirm_pwd" class="inputbox password confirmpwd" />-->
            <!--</div>-->
            <!--<button type="submit" class="signUp" onclick="check_pwd();">确认</button>-->
            <span  class="signUp" onclick="loginCandy()" >确认</span>

        <!--</form>-->
    </div>
    <!--注册后显示-->
    <div class="login_form" id="BOX_Success">
        <form action="">
            <!--<p class="color_eee ptitle">Enter your phone number</p> -->
            <!--<input type="hidden" id="phone" name="phone_number" class="inputbox" autofocus="" placeholder="15902464545" value="15928991751" />-->
            <p class="color_eee ptitle" style="margin-top: 15px">请输入密码！</p>
            <div class="pswd_box">
                <i class="password_icon"></i>
                <input type="password" name="password" id="password" class="inputbox password" autofocus="" />
                <input id="dialcode" name="dialcode" type="hidden" value="86" />
                <input id="countrycode" name="countrycode" type="hidden" value="cn" />
            </div>
            <!--<button type="submit" class="signUp">点击登陆</button>-->
            <a href="../Success_child_Candy%20Box/Success_child_Candy%20Box.html"> <span type="submit" class="signUp">点击登陆</span></a>
        </form>
        <form action="https://candy.one/user/lostpwd" method="post" name="find_form">
            <!--<input type="hidden" id="phone" name="phone" class="inputbox" autofocus="" placeholder="15902464545" value="15928991751" />-->
            <input name="dialcode" type="hidden" value="86" />
            <input name="countrycode" type="hidden" value="cn" />
            <input name="enroll_id" type="hidden" value="0" />
            <p class="sign_now"><a style="color: #fff;" onclick="fun_sub();">忘记密码?</a></p>
        </form>
    </div>
    <!--<div class="jump">-->
    <!--<a href="https://t.me/candyoneofficial" target="_blank"></a>-->
    <!--</div>-->
    <div class="news">
        <ul>
            <li>
                <div class="fl position_rel leftimg">
                    <img th:src="@{/img/AIT/login/CANDY.png}"  width="36" />
                    <span class="new">NEW</span>
                </div>
                <div class="rightcontent">
                    <p>Number of Candy.ONE users has surpassed 2 million just now! Invite more friends and get more candies! </p>
                    <div class="clearfix bottomdesc">
                        <a href="https://candy.one/" class="fl"></a>
                        <span class="fr datetime">23:30 2018.01.25</span>
                    </div>
                </div>
            </li>
            <li>
                <div class="fl position_rel leftimg">
                    <img th:src="@{/img/AIT/login/GCT.png}"  width="36" />
                    <span class="new">NEW</span>
                </div>
                <div class="rightcontent rightcontent_bottom">
                    <p>14 million Geek Chain Tokens(GCT) have been locked in Candy Box. The box is now worth about 64 million USD.</p>
                    <div class="clearfix bottomdesc">
                        <a href="https://candy.one/" class="fl"></a>
                        <span class="fr datetime">10:00 2018.01.25</span>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</div>
<!--
1****.需要一个注册页面。。。通过邮箱注册，然后一个交互效果显示出输入邮箱收到的验证码
2****.输入验证码后，，registerCodeOp ajax有相应的注释，判断验证码是否有效，有效就进入设置账号和密码的界面
3.用户设置账号、密码、确认密码 下一步登录
4.进入前端页面

-->


<script type="text/javascript">

    /*<![CDATA[*/


    $(function () {
    });

    //输入邮箱。获取验证码
    $("#BOX_Mailbox_btn").click(function(){
    	if(checkEmail() == false){    		
    		return;
    	}
        $("#BOX_Mailbox").css("display","none");
        $("#BOX_Code").css("display","block");

        registerCodeOp();
    })


    //输入验证码后确认
    $("#BOX_Code_btn").click(function(){
//        $("#BOX_Code").css("display","none");
//        $("#BOX_Pwd").css("display","block");

        judgeCode();
    })

    //1****注册糖果操作，使用户收到验证码
    function registerCodeOp() {
        //获取邀请码，判断是否是通过邀请调到登录界面的
        var code = $("#invitcode").val();
        //获取邮箱
        var registerMail = $("#registerMail").val();
        $.ajax({
            //url:baseUrlHL + "/app/index/openOrder?userid="+userid,    //请求的url地址
            url: "/candybox/registerCandy?registerMail="+registerMail + "&code="+code,    //请求的url地址
            dataType: "json",   //返回格式为json
            async: false,//请求是否异步，默认为异步，这也是ajax重要特性
            type: "POST",   //请求方式
            success: function (r) {
                var data = r.data.result;
                if (data == "true") {
                    alert("验证码已发往您的邮箱，请注意查收！");
                }else{
                    alert("请勿在一分钟内重复注册");
                }

            }
        });



    }
    //2****判断验证码
    function judgeCode() {
        var authCode = $("#code").val(); //获取验证码
        var registerMail = $("#registerMail").val();
        $.ajax({
            url: "/candybox/judgeCode?authCode="+authCode + "&registerMail="+registerMail,
            dataType: "json",
            async: false,
            type: "GET",
            success: function (r) {
//                    alert("验证码错误");
                var data = r.data.result;

                if (data == "true") {
                    //验证码正确 显示密码输入框
                    $("#BOX_Code").css("display","none");
                    $("#BOX_Pwd").css("display","block");


                } else {
                    //弹出相应的返回信息
                    alert("验证码无效");
                }

            }
        });

    }

    //3****设置相应的账号和密码 param 1 表示注册操作 0 表示0登录操作
    function loginCandy(param) {
        var candyUser = "";
        var candyPasswd = $("#usr_pwd").val();
        var registerMail = $("#registerMail").val();

        var regisOrlogin = param;
        $.ajax({
            url: "/candybox/loginCandy?candyPasswd="+candyPasswd+"&registerMail="+registerMail+"&regisOrlogin="+regisOrlogin,
            dataType: "json",
            async: false,
            type: "GET",
            success: function (r) {
//                    alert("验证码错误");
                var data = r.data.result;
                var registerMail = r.data.registerMail;
                var invitecode = r.data.invitecode;
                if (data == "true") {
                    //成功，登录前台页面
                    window.location.href = "/candyboxbis/candyboxPage?registerMail="+registerMail;
                } else {
                    var message = r.data.message;
                    //弹出相应的返回信息
                    alert(message);
                }

            }
        });

    }

    /*]]>*/

</script>
<script type="text/javascript">
//判断用户输入的电子邮箱格式是否正确
function checkEmail(){
 	
	var myemail =  $("#registerMail").val();         
	var myReg=/^[a-zA-Z0-9_-]+@([a-zA-Z0-9]+\.)+(com|cn|net|org)$/;
	 
	if(myReg.test(myemail)){
		return true;
	}else{
		//myspan.innerText="邮箱格式不对!";The format of the email is not correct
		//console.log("邮箱格式不对!");
		alert("邮箱格式不对!");
		return false;
	}
} 
</script>
</body>
</html>